//
//  UIButton+Extension.swift
//  iOSweibo
//
//  Created by lzm on 16/5/20.
//  Copyright © 2016年 lzm. All rights reserved.
//

import UIKit
extension UIButton
{
    convenience init(BKGimage:String,imageName:String,title:String,titleColor:UIColor = UIColor.lightGrayColor(),fontSize: CGFloat = 12){
        self.init(type:UIButtonType.Custom)
        //背景图
        self.setBackgroundImage(UIImage(named: BKGimage), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(BKGimage)_highlighted"), forState: UIControlState.Highlighted)
        //图片
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(titleColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        
        
    }
}
